package com.ken.checkviolationapp.ui.dashboard

import com.ken.base_http_library.ServiceCreator
import com.ken.base_http_library.http_api_service.JuHeApiService
import com.ken.base_http_library.oil_price.OilPriceResponse
import com.ken.base_http_library.response.JuHeBaseResponse
import com.ken.checkviolationapp.BuildConfig
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.observers.DisposableObserver
import io.reactivex.schedulers.Schedulers
import org.junit.Test

import org.junit.Assert.*

/**
 * @author by ken
 * Blog:
 * Date:2020/5/8
 * Description:
 */
class DashboardFragmentTest {

    @Test
    fun getGNYJ() {
        var service = ServiceCreator.create(JuHeApiService::class.java)

        service.getTodayOilPrice("2ffa84a5e1d7176835dbafc83f97a648")
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(object : DisposableObserver<JuHeBaseResponse<OilPriceResponse>>() {
                override fun onComplete() {

                }

                override fun onNext(t: JuHeBaseResponse<OilPriceResponse>) {
                    println("code..${t.error_code}" + "result...${t.reason}")

                }

                override fun onError(e: Throwable) {
                    println("message..${e.message}")
                }


            })
    }
}